home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / fpu881 / src6.zoo / modf.s < prev    next >
Text File  |  1991-09-24  |  1KB  |  67 lines

  1. # pml compatible lib for the atari sfp004
  2. #
  3. # Michael Ritzert, Oktober 1990
  4. # ritzert@dfg.dbp.de
  5. #
  6. # FUNCTION:    double MODF(double X, double * Y)
  7. #
  8. # base =    0xfffa50
  9. #      the fpu addresses are taken relativ to "base":
  10. #
  11. # a0: fpu base address
  12. # a1: return address for int part
  13. #
  14.  
  15. # waiting loop ...
  16. #
  17. # wait:
  18. # ww:    cmpiw    #0x8900,a1@(resp)
  19. #     beq    ww
  20. # is coded directly by
  21. #    .long    0x0c688900, 0xfff067f8 (a0)
  22. # and
  23. # www:    tst.w    a0@(resp)
  24. #    bmi.b    www
  25. # is coded by
  26. #    .word    0x4a68,0xfff0,0x6bfa        | test
  27. #
  28.  
  29. comm =     -6
  30. resp =    -16
  31. zahl =      0
  32.  
  33. .even
  34. .text
  35.     .globl _modf
  36. .even
  37. _modf:
  38.     movel    a1,a7@-
  39.     lea    0xfffa50,a0
  40.     movew    #0x5403,a0@(comm)    | fintrz X -> fp0
  41.     cmpiw    #0x8900,a0@(resp)    | check
  42.     movel    a7@(8),a0@        | load X_hi
  43.     movel    a7@(12),a0@        | load X_low
  44.  
  45.     movew    #0x5480,a0@(comm)    | X -> fp1
  46.     .long    0x0c688900, 0xfff067f8
  47.     movel    a7@(8),a0@        | load X_hi
  48.     movel    a7@(12),a0@        | load X_low
  49.  
  50. #    movew    #%0000 0000 1010 1000,a0@(comm)    | sub fp0 -> fp1
  51.     movew    #0x00a8,a0@(comm)        | sub fp0 -> fp1
  52.     .word    0x4a68,0xfff0,0x6bfa        | test
  53.  
  54.     movew    #0x7400,a0@(comm)    | fp0 to IntPart
  55.     moveal    a7@(16),a1        | address of IntPart while the fpu is active
  56. # wait
  57.     .long    0x0c688900, 0xfff067f8
  58.     movel    a0@,a1@+
  59.     movel    a0@,a1@+
  60.     movew    #0x7480,a0@(comm)    | Rest to d0/d1
  61. # wait
  62.     .long    0x0c688900, 0xfff067f8
  63.     movel    a0@,d0
  64.     movel    a0@,d1
  65.     movel    a7@+,a1
  66.      rts
  67.